from django.shortcuts import render,render_to_response
from django.template import loader,Context
from django.http import HttpResponse
from blog.models import BlogPost



# Create your views here.
"""
def archive(request):
    posts=BlogPost.objects.all()
    t=loader.get_template('archive.html')
    c=Context({'posts':posts})
    return HttpResponse(t.render(c))
"""


class Person(object):
    def __init__(self,name,age,sex):
        self.name=name
        self.age=age
        self.sex=sex

    def say(self):
        return "I am " + self.name

def archive(req):
    user=Person('guolt',30,'male')
    booklist=['hello','world','guolt','yangman']
    return render_to_response('archive.html',{'title':'guoyuzhe','user':user,'booklist':booklist})


def hello(request):
    return HttpResponse("hello world!")


def greet(persion_name):
    
    return HttpResponse('hello %s' % str(persion_name))

def index(req,id):
    return render_to_response('index.html',{'id':id})

